Normalize the RHS of an Unsize goal in the new solver - #113393
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unsizegoals are... tricky. Not only do they structurally match on their self type, but they're also structural on their other type parameter. I'm pretty certain that it is both incomplete and also just plain undesirable to not consider normalizing the RHS of an unsize goal. More practically, I'd like for this code to work:In order to achieve this, we add
EvalCtxt::normalize_non_self_ty(naming modulo bikeshedding), which must be used for all non-self type arguments that are structurally matched in candidate assembly. Currently this is only necessary forUnsize's argument, but I could see future traits requiring this (hopefully rarely) in the future. It usesrepeat_while_noneto limit infinite looping, and normalizes the self type until it is no longer an alias.Also, we need to fix feature gate detection for
trait_upcastingandunsized_tuple_coercionwhen HIR typeck has unnormalized types. We can do that by checking theImplSourcereturned by selection, which necessitates adding a new impl source for tuple upcasting.